import { defineStore } from "pinia";
import { ref } from 'vue' 
export const useConsultStore = defineStore(
	'consult',()=>{
		const consult = ref({})
		const setConsult = (val) => {
			consult.value.illnessDesc = val.illnessDesc
			consult.value.illnessTime = val.illnessTime
			consult.value.consultFlag = val.consultFlag
			consult.value.pictures = val.pictures
		}
		//保存depId
		const setDepId = (val) => {
			consult.value.depId = val
		}
		//保存问诊科室类型
		const setType = val => consult.value.type = val
		const setIllnessType = val => consult.value.illnessType = val
		const delConsult = () => consult.value = {}
		return { consult,setConsult,setDepId,setType,setIllnessType,delConsult }
		
	},
	{
		persist:{
				storage:{
					setItem:(key,val)=>{
						 uni.setStorageSync(key,val)
					},
					getItem:(key)=>{
						return uni.getStorageSync(key)
					},
				}
		}
	}
)